#ifndef YOOHOO_XMPPCORE_PRESENCE_H
#define YOOHOO_XMPPCORE_PRESENCE_H

#include "xmppcore/stanza.h"
#include "xmppcore/xmllangtext.h"
#include "xmppcore/protocolkey.h"

#include <QtCore/QList>
#include <QtCore/QSharedDataPointer>

namespace yoohoo_xmppcore {

class PresenceSharedData;

class YOOHOO_XMPPCORE_EXPORT Presence : public Stanza {
public:
	enum PresenceType {
		PresenceTypeNone,
		PresenceTypeAvailable,
		PresenceTypeUnavailable,
		PresenceTypeSubscribe,
		PresenceTypeSubscribed,
		PresenceTypeUnsubscribe,
		PresenceTypeUnsubscribed
	};

	enum PresenceShow {
		PresenceShowNone,
		PresenceShowChat,
		PresenceShowAway,
		PresenceShowDND,
		PresenceShowXA
	};

	static const ProtocolKey PROTOCOL_KEY;
	static const int PRIORITY_NOT_SET;

	Presence();
	Presence(const Presence& other);
	void setPresenceShow(Presence::PresenceShow show);
	Presence::PresenceShow presenceShow() const;
	void setStatus(QList<XmlLangText> status);
	QList<XmlLangText>& status();
	void setPriority(int priority);
	int priority() const;
	Stanza::StanzaKind stanzaKind() const;
	void setPresenceType(Presence::PresenceType type);
	Presence::PresenceType presenceType() const;

protected:
	virtual void doToXml(XmlWriter* xmlWriter);

protected:
	QSharedDataPointer<PresenceSharedData> _pd;
};

class PresenceSharedData : public QSharedData {
public:
	PresenceSharedData();
	PresenceSharedData(const PresenceSharedData& other);

	Presence::PresenceShow presenceShow;
	QList<XmlLangText> status;
	int priority;
	Presence::PresenceType presenceType;
};

}

#endif
